package com.gears_software.sxdc.dccx.ui.activity;

import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.WindowManager;

import com.gears_software.sxdc.dccx.R;
import com.gears_software.sxdc.dccx.data.sharedPreference.DCCXSp_;
import com.gears_software.sxdc.dccx.ui.util.SampleSlide;
import com.github.paolorotolo.appintro.AppIntro;
import com.github.paolorotolo.appintro.AppIntroFragment;


/**
 * Created by henry on 16/6/21.
 */

public class Intro extends AppIntro {

    DCCXSp_ sp;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //全屏显示
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

        sp = new DCCXSp_(this);
        addSlide(SampleSlide.newInstance(R.layout.intro1));
        addSlide(SampleSlide.newInstance(R.layout.intro2));

        sp.isFirst().put(false);

        setSkipText("跳过");
        setDoneText("立即体验");
        setImageNextButton(getResources().getDrawable(R.mipmap.right));
        setColorSkipButton(getResources().getColor(R.color.colorFontBigGray));
        setColorDoneText(getResources().getColor(R.color.colorFontBigGray));
        setIndicatorColor(getResources().getColor(R.color.colorFontBigGray), getResources().getColor(R.color.colorActionbar));
        setBarColor(Color.parseColor("#e0f0f0f0"));
        setSeparatorColor(Color.parseColor("#f0f0f0"));

        setFadeAnimation();
    }

    private void loadLoginActivity() {
        Intent intent = new Intent(this, MainActivity_.class);
        startActivity(intent);
        this.finish();
    }

    @Override
    public void onSkipPressed(Fragment currentFragment) {
        super.onSkipPressed(currentFragment);
        loadLoginActivity();
    }

    @Override
    public void onDonePressed(Fragment currentFragment) {
        super.onDonePressed(currentFragment);
        loadLoginActivity();
    }

}
